package cz.cvut.fel.riak.stats;

import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLong;

public class Statistics {
	private static Statistics stats = null;
	public AtomicInteger docs  = new AtomicInteger();
	public AtomicLong latency = new AtomicLong();
	//private long docs;
	private long start;
	
	public static synchronized Statistics getInstance() {		
		if (stats == null) {
			stats = new Statistics();
			stats.start = System.currentTimeMillis();
		}
			
		return stats;
	}
	
	public void add() {
		docs.getAndIncrement();
	}
	
//	public synchronized long getStats() {
		//long now = System.currentTimeMillis();
		//return (docs);///(now-start));
		//System.out.println("Time="+(now-start)/(1000)+" docs="+docs+" ops/s="+ ((now-start)/(1000))/docs);
		//return docs/( ((now-start)/(1000) == 0 ? 1 : ((now-start)/(1000) )));
		////return (docs / ((now-start)/10^9 ) );
	//}
}
